<template>
  <c-form :inline="true" :form="form" ref="refForm" v-if="showCondition"></c-form>
</template>

<script>
  import {sequenceFlowForm} from "@/components/bpmn/components/bpmnPropertiesPanel/forms";
  import Form from "@/components/Form.vue";

  export default {
    name: "Properties_SequenceFlow",
    components:{
      "c-form": Form
    },
    data(){
      return {
        form: sequenceFlowForm.call(this),
        showCondition: true,
      }
    },
    methods: {
      dataReset(){
        const typeHash = {
          "bpmn:ExclusiveGateway": true,
          "bpmn:ParallelGateway": true,
          "bpmn:InclusiveGateway": true
        };
        const sourceType = this.businessObj.sourceRef.$type;
        this.showCondition = !!typeHash[sourceType];
        if(this.showCondition){
          const conditionExpression = this.modeler.getProperty("conditionExpression");
          this.form.models.condition = conditionExpression?.body || "";
        }
      }
    },
  }
</script>